﻿@model Zatify.WebUI.Models.UserProfileBusinessesSearchViewModel
@{
    ViewBag.Title = "Search";
    ViewBag.ContentTitle = "Search";
    Layout = "~/Views/Shared/_ContentLayoutWithPaging.cshtml";
}
@section Search
{
    <div class="bradcum_search">
        <div class="search">
            @using (Html.BeginForm())
            {
                <input type="hidden" id="page" name="page" value="1" />
                <input type="text" name="Search" id="search" title="Search" class="search_inputbox"
                    placeholder="Search" />
                <input type="submit" value="GO" class="search_btn" />
            }
        </div>
    </div>
    <div class="clearfix">
    </div>
}
@section ContentTitleButton
{
    <a href="@Url.Action("SearchMap", new { search = @Model.Search })" class="red_btn" style="float: right;">
        Map</a>
}
<div class="deal_display">
    <ul>
        @foreach (var business in Model.Businesses)
        {
            <li><a href="@Url.Action("BusinessDetails", new { id = business.BusinessId })">
                <div style="width: 298px; height: 180px; text-align: center; background:url('@Url.Action("GetBusinessPhoto", "UserProfile", new { businessId = business.BusinessId, w = 298, h = 170 })') no-repeat scroll center center transparent">
                    @*<img alt="" src="@Url.Action("GetBusinessPhoto", "UserProfile", new { businessId = business.BusinessId, w = 298, h = 170 })" />*@
                </div>
                <div class="deal_thumb_content">
                    <h4 title="@business.BusinessName">
                        @InlineHelpers.TrimText(business.BusinessName, 25)</h4>
                    <div class="rating_price">
                        @InlineHelpers.FiveStarsRatingReadonly(business.Rating)
                        <span class="rating_text">
                            @business.ReviewsCount Reviews</span>
                        <div class="thumb_price">
                            $$</div>
                    </div>
                    <p class="gold">
                        @if (!String.IsNullOrEmpty(business.StreetAddress1))
                        {
                            @InlineHelpers.TrimText(business.StreetAddress1, 35)
                        }
                        else
                        {
                            <text>&nbsp;</text> 
                        }
                    </p>
                    <p class="gray">
                        @if (business.Distance.HasValue)
                        { 
                            @business.Distance.Value.ToString("0.00")<text> mi</text>
                        }
                        else
                        {
                            <text>N/A</text>
                        }
                    </p>
                    <p class="gray">
                        @if (business.Categories != null && business.Categories.Count() > 0)
                        {
                            @InlineHelpers.TrimText(InlineHelpers.BusinessCategories(business.Categories).ToString(), 35)
                        }
                        else
                        {
                            <text>&nbsp;</text> 
                        }
                    </p>
                </div>
            </a></li>
        }
    </ul>
</div>
@section Paging
{
    @Html.Pager(Model.PagingInfo, x => Url.Action("Search", new { search = Model.Search, page = x }), 3)
}
